package de.fanuffel.generic.functions;

import de.fanuffel.generic.structures.Pair;

public abstract class BiFun<A, B, C> implements Function<Pair<A, B>, C> {

  public abstract C eval(Pair<A, B> arg);

  public C eval(A a, B b) {
    return eval(new Pair<A, B>(a, b));
  }

  public Function<B, C> apply(final A a) {
    final BiFun<A, B, C> t = this;
    return new Function<B, C>() {
      public C eval(B b) {
        return t.eval(a, b);
      }
    };
  }

}
